<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../node_modules/vue/dist/vue.js"></script>
    <style>
        .v-enter,.v-leave-to{
            opacity: 0;
        }
        .v-enter-active,.v-leave-active{
            transition:opacity 1s;
        }

    </style>
</head>
<body>
    <div id="root">
<!-- 
    当列表发生变化的时候
    这个因为有很多呀,所以应该用transation-group标签把内容包裹起来
 -->
    <transition-group>
         <div v-for="(item, index) in list" :key="item.id">{{item.title}}</div>
    </transition-group>
           <button @click="handleBtnClick">add</button>

    </div>
<script>
    var vm  = new Vue({
        el:"#root",
        data:{
            list:[],
            list1:[1,2,3,4,5,6,7],
            count:0
        },
        methods:{
            handleBtnClick(){
                this.list.push({
                    id:this.count++,
                    title:'hello World'
                })
            }
        }
    })
</script>



</body>
</html>